gint hot_x,
gint hot_y)
{
- GDK_WAYLAND_DRAG_CONTEXT (context)->hot_x = hot_x;
- GDK_WAYLAND_DRAG_CONTEXT (context)->hot_y = hot_y;
+ GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
+ gint prev_hot_x = context_wayland->hot_x;
+ gint prev_hot_y = context_wayland->hot_y;
+ const GdkRectangle damage_rect = { .width = 1, .height = 1 };
+
+ context_wayland->hot_x = hot_x;
+ context_wayland->hot_y = hot_y;
+
+ if (prev_hot_x == hot_x && prev_hot_y == hot_y)
+ return;
+
+ _gdk_wayland_window_offset_next_wl_buffer (context_wayland->dnd_window,
+ -hot_x, -hot_y);
+ gdk_window_invalidate_rect (context_wayland->dnd_window, &damage_rect, FALSE);
}
static void
GdkDragContext *_gdk_wayland_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets);
+void _gdk_wayland_window_offset_next_wl_buffer (GdkWindow *window,
+ int x,
+ int y);
+
GdkDragContext * _gdk_wayland_drop_context_new (struct wl_data_device *data_device);
void _gdk_wayland_drag_context_set_source_window (GdkDragContext *context,
GdkWindow *window);
GdkWindow *transient_for;
cairo_surface_t *cairo_surface;
+ int pending_buffer_offset_x;
+ int pending_buffer_offset_y;
gchar *title;
/* Attach this new buffer to the surface */
wl_surface_attach (impl->surface,
_gdk_wayland_shm_surface_get_wl_buffer (impl->cairo_surface),
- 0, 0);
+ impl->pending_buffer_offset_x,
+ impl->pending_buffer_offset_y);
+ impl->pending_buffer_offset_x = 0;
+ impl->pending_buffer_offset_y = 0;
/* Only set the buffer scale if supported by the compositor */
display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
maybe_set_gtk_surface_dbus_properties (window);
}
+
+void
+_gdk_wayland_window_offset_next_wl_buffer (GdkWindow *window,
+ int x,
+ int y)
+{
+ GdkWindowImplWayland *impl;
+
+ g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window));
+
+ impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+
+ impl->pending_buffer_offset_x = x;
+ impl->pending_buffer_offset_y = y;
+}